// ==========================================================================
// GFast自动生成controller操作代码。
// 生成日期：2024-01-04 11:04:57
// 生成路径: internal/app/flow/controller/flow_form.go
// 生成人：gfast
// desc:流程表单
// company:云南奇讯科技有限公司
// ==========================================================================

package controller

import (
	"context"

	"github.com/tiger1103/gfast/v3/api/v1/flow"
	"github.com/tiger1103/gfast/v3/internal/app/flow/service"
	systemController "github.com/tiger1103/gfast/v3/internal/app/system/controller"
)

type flowFormController struct {
	systemController.BaseController
}

var FlowForm = new(flowFormController)

// List 列表
func (c *flowFormController) List(ctx context.Context, req *flow.FlowFormSearchReq) (res *flow.FlowFormSearchRes, err error) {
	res = new(flow.FlowFormSearchRes)
	res.FlowFormSearchRes, err = service.FlowForm().List(ctx, &req.FlowFormSearchReq)
	return
}

// Get 获取流程表单
func (c *flowFormController) Get(ctx context.Context, req *flow.FlowFormGetReq) (res *flow.FlowFormGetRes, err error) {
	res = new(flow.FlowFormGetRes)
	res.FlowFormInfoRes, err = service.FlowForm().GetById(ctx, req.Id)
	return
}

// Add 添加流程表单
func (c *flowFormController) Add(ctx context.Context, req *flow.FlowFormAddReq) (res *flow.FlowFormAddRes, err error) {
	err = service.FlowForm().Add(ctx, req.FlowFormAddReq)
	return
}

// Edit 修改流程表单
func (c *flowFormController) Edit(ctx context.Context, req *flow.FlowFormEditReq) (res *flow.FlowFormEditRes, err error) {
	err = service.FlowForm().Edit(ctx, req.FlowFormEditReq)
	return
}

// Delete 删除流程表单
func (c *flowFormController) Delete(ctx context.Context, req *flow.FlowFormDeleteReq) (res *flow.FlowFormDeleteRes, err error) {
	err = service.FlowForm().Delete(ctx, req.Ids)
	return
}
